package com.yuexunit.mobilenurse.module.BloodManage.adapter;

import android.content.Intent;
import android.view.View;
import android.widget.AbsListView;

import com.yuexunit.mobilenurse.R;
import com.yuexunit.mobilenurse.module.BloodManage.bean.Blood;
import com.yuexunit.mobilenurse.module.BloodManage.ui.Act_Blood_ApplyDetail;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by work-jx on 2017/10/12.
 */
public class ApplyAdapter extends KJAdapter<Blood>{
    public ApplyAdapter(AbsListView view, Collection<Blood> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, Blood item, boolean isScrolling, int position) {
        super.convert(helper, item, isScrolling, position);
        helper.setText(R.id.item_apply_tv,"申请单号:"+item.getRequireNo());
        onPicClick(helper.getConvertView(), item.getRequireNo());
    }

    private void onPicClick(View view,final String no) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                    Intent intent = new Intent(mCxt, Act_Blood_ApplyDetail.class);
                    intent.putExtra("requireNo",no);
                    mCxt.startActivity(intent);
            }
        });
    }
}
